# IT Бахилина

import time

def b_sort(nun):
    swapped = True
    while swapped:
       swapped = False
       for i in range(len(nun) - 1):
           if nun[i] > nun[i + 1]:
               nun[i], nun[i + 1] = nun[i + 1], nun[i]
               swapped = True

def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data

pizza = read2list("m1_sorted.txt")
pasta = read2list("m2_reverse.txt")
information = read2list("m3_shuffle.txt")

t_start = time.time()
b_sort(pizza)
t_finish = time.time()
print("m1_sorted",round((t_finish-t_start)*1000),"milliseconds")

t_start = time.time()
b_sort(pasta)
t_finish = time.time()
print("m2_reverse",round((t_finish-t_start)*1000),"milliseconds")

t_start = time.time()
b_sort(information )
t_finish = time.time()
print("m3_shuffle",round((t_finish-t_start)*1000),"milliseconds")
